package function

import scala.util.control.Breaks

class Loop {
  def loopTest(): Unit ={
    for (i<-Range(1,5)) println(i)
    println("=============")
    for (i<-1 to 5 ) println(i)
    println("===========")
    for (i<-1 to 5 if (i%2)==0) println(i)
    for (i<-1 to 5 by 2) println(i)
    val value = for(i <- 1 to 5) yield i * 20
    println(value)
    Breaks.breakable({
      for(i<-1 to 5 if (i%2)==0)
        {
          println(s"i=${i}")
          if(i==4)
            {
              Breaks.break()
            }
        }
    })
  }

}
object Loop{

}
